package com.shiwaixiangcun.monitor.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.shiwaixiangcun.core.utils.MonkeyUtils;
import com.shiwaixiangcun.monitor.enums.HealthStatus;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017-11-27.
 */
public class DangerWarningListDto {
    private Long waringId;

    private String name;   //名字或者位置别名
    private String avatar;//头像
    private Integer age;
    private String sex;
    private String waringTime;
    private String longitude; //经度
    private String latitude;  //纬度
    private HealthStatus status;//状态
    private Boolean isBeeper;//是否是呼叫器预警

    @JSONField(serialize = false)
    private Date waringDate;

    private String speechUrl;
    private Boolean play;


    private List<String> waringData;

    public String getSpeechUrl() {
        return speechUrl;
    }

    public void setSpeechUrl(String speechUrl) {
        this.speechUrl = speechUrl;
    }

    public Boolean getPlay() {
        return play;
    }

    public void setPlay(Boolean play) {
        this.play = play;
    }

    public Boolean getBeeper() {
        return isBeeper;
    }

    public void setBeeper(Boolean beeper) {
        isBeeper = beeper;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public HealthStatus getStatus() {
        return status;
    }

    public void setStatus(HealthStatus status) {
        this.status = status;
    }

    public Long getWaringId() {
        return waringId;
    }

    public void setWaringId(Long waringId) {
        this.waringId = waringId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getWaringTime() {
        Date now = MonkeyUtils.now();
        long nowTime = now.getTime();
        long waringDateTime = waringDate.getTime();
        Long cha = nowTime - waringDateTime;
        if (cha <= 60000) {
            return "刚刚";
        } else if (cha <= 420000) {
            long chu = cha / 60000;
            return chu + "分钟前";
        }
        return MonkeyUtils.toDateText(waringDate, MonkeyUtils.DEFAULT_DATE_TIME_FORMAT);
    }

    public void setWaringTime(String waringTime) {
        this.waringTime = waringTime;
    }

    public Date getWaringDate() {
        return waringDate;
    }

    public void setWaringDate(Date waringDate) {
        this.waringDate = waringDate;
    }

    public List<String> getWaringData() {
        return waringData;
    }

    public void setWaringData(List<String> waringData) {
        this.waringData = waringData;
    }
}
